//
//  MYNewsDetailsActionVC.m
//  MuYing
//
//  Created by tbb on 2019/8/6.
//  Copyright © 2019 TBB. All rights reserved.
//

#import "MYNewsDetailsActionVC.h"
#import "MYNewsDetailsModel.h"
#import "MYNewsShopDetailsActionVC.h"
@interface MYNewsDetailsActionVC ()

@end

@implementation MYNewsDetailsActionVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

-(void)goToBuyVC:(UIButton *)sender {
    MYNewsShopDetailsActionVC *reserveHotelVC = [MYNewsShopDetailsActionVC new];
    reserveHotelVC.informationId = self.informationId;
    kYQPUSH(reserveHotelVC);
}

-(void)setupView {
    [super setupView];
    kYQREGISTERTABLEVIEWCELL([MYNewsDetailsActionTitleCell class])
}

#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [super tableView:tableView numberOfRowsInSection:section];
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            MYNewsDetailsActionTitleCell *titleCell = [tableView dequeueReusableCellWithIdentifier:@"MYNewsDetailsActionTitleCell"];
            
            [titleCell.callBtn setTitle:[NSString stringWithFormat:@"%@\n%@",self.detailsModel.likeNumber,kYQLS(@"点赞")] forState:(UIControlStateNormal)];
            [titleCell.collectionBtn setTitle:[NSString stringWithFormat:@"%@\n%@",self.detailsModel.collectNumber,kYQLS(@"收藏")] forState:(UIControlStateNormal)];
            
            [titleCell.lookCountBtn setTitle:[NSString stringWithFormat:@"%@\n%@",self.detailsModel.browseNumber,kYQLS(@"用户看过")] forState:(UIControlStateNormal)];
            titleCell.titleLb.text = self.detailsModel.name;
//            titleCell.enNameLb.text = self.detailsModel.englishName;
            return titleCell;
        }
    }
    if (indexPath.section == 2) {
        MYNewsDetailsMoreModel *moreModel = nil;
        if (indexPath.row < self.detailsModel.moreList.count) {
            moreModel = self.detailsModel.moreList[indexPath.row];
        }
        
        MYNewsGoodsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MYNewsGoodsCell"];
        
        cell.titleLb.text = moreModel.title;
        cell.distanceLb.text = moreModel.distanceStr;
        cell.priceLb.text = kYQLS(@"查看");
        
        return cell;
    }
    return [super tableView:tableView cellForRowAtIndexPath:indexPath];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            return 102;
        }
    }
    return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    if (section == 2) {
        MYShopDetailsTitleHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"MYShopDetailsTitleHeaderView"];
        headerView.titleLb.text = kYQLS(@"相关活动");
        return headerView;
        
    }
    return [super tableView:tableView viewForHeaderInSection:section];
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    if (section == 2) {
        return 52;
    }
    return [super tableView:tableView heightForHeaderInSection:section];
}
#pragma mark - UITableViewDelegate, UITableViewDataSource end
@end
